package com.itheima.controller;

import com.itheima.dto.PageResult;
import com.itheima.dto.RequestDto;
import com.itheima.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/hotel")
public class HotelController {
    @Autowired
    private HotelService hotelService;

    @PostMapping("/list")
    public PageResult search(@RequestBody RequestDto requestDto){
        return hotelService.search(requestDto);
    }

    @PostMapping("/filters")
    public Map<String, List<String>> filters(@RequestBody RequestDto requestDto){
        return hotelService.filters(requestDto);
    }

    @GetMapping("/suggestion")
    public List<String> suggestion(@RequestParam String key){
        return hotelService.suggestion(key);
    }


}
